package com.agua.enturno.vista.paginas.prestador;

import com.agua.enturno.vista.dto.AgendaDTO;
import com.agua.enturno.vista.util.SemanasIterator;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.joda.time.DateTimeConstants;
import org.joda.time.LocalDate;

public class AgendaFullPanel extends Panel {

	private static final long serialVersionUID = 1L;

	private SemanasIterator semanasIterator;
	
	public AgendaFullPanel(String id, IModel<AgendaDTO> model) {
		super(id);
		this.setOutputMarkupId(true);
		
		this.semanasIterator = new SemanasIterator(model, LocalDate.now().withDayOfWeek(DateTimeConstants.MONDAY));
		
		add(new AgendaNavigationPanel("agenda-navigation", semanasIterator));
		add(new AgendaPanel("agenda", semanasIterator));
		add(new AgendaDetailsPanel("agenda-details", semanasIterator));
	}
	
	@Override
	protected void onBeforeRender() {
		
		this.semanasIterator.recargarHorarios();
		this.semanasIterator.reset();
		super.onBeforeRender();
	}

}
